import { TRuneGuide } from "../../../Message/Db/Tables/TRuneGuide";
import { ConfigManager } from "../../../com/gengine/resource/ConfigManager";
//class RuneGuideConfig
    
    export  class RuneGuideConfig
    {
        constructor()
        {
            
            this._map = new Map<any, any> /* flash.utils.Dictionary */();
            this._list = [];
            if (RuneGuideConfig._instance) 
            {
                throw new Error("RuneGuideConfig is single model");
            }
            this.init();
            return;
        }

        /* internal  */write(arg1: Object): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=0;
            var loc4=arg1;
            for(loc2 of loc4) 
            {
                loc1 = new TRuneGuide();
                loc1.itemCode = loc2.itemCode;
                loc1.oldPrice = loc2.oldPrice;
                loc1.price = loc2.price;
                loc1.sellNum = loc2.sellNum;
                loc1.sellUnit = loc2.sellUnit;
                loc1.id = loc2.id;
                this._map[loc1.itemCode] = loc1;
                this._list.push(loc1);
            }
            this._list.sortOn("id", Array.NUMERIC);
            return;
        }

        public init(): void
        {
            var loc1=ConfigManager.instance.getJSONByFileName("t_rune_guide.json");
            this.write(loc1);
            return;
        }

        public RuneGuideConfig.get list(): Array<any>
        {
            return this._list;
        }

        public static get instance(): RuneGuideConfig
        {
            if (!RuneGuideConfig._instance) 
            {
                RuneGuideConfig._instance = new RuneGuideConfig();
            }
            return RuneGuideConfig._instance;
        }

        /* internal */ /* var */_map: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ /* var */_list: Array<any>;

        /* internal */ static /* var */_instance: RuneGuideConfig;
    }
